package com.chixing.day10_hashcode_exception.homework;



import java.util.Objects;

public class Position {
    private int potId;
    private String potName ;
    private float potMaxMoney; //最高工资
    private float potMinMoney; //最低工资
    private String potCity; //城市
    private String potEducation; //学历

    private Company company;  // 所属公司

    public Position(int potId, String potName, float potMaxMoney, float potMinMoney, String potCity, String potEducation, Company company) {
        this.potId = potId;
        this.potName = potName;
        this.potMaxMoney = potMaxMoney;
        this.potMinMoney = potMinMoney;
        this.potCity = potCity;
        this.potEducation = potEducation;
        this.company = company;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Position position = (Position) o;
        return potId == position.potId && Float.compare(position.potMaxMoney, potMaxMoney) == 0 &&
                Float.compare(position.potMinMoney, potMinMoney) == 0 && Objects.equals(potName, position.potName) &&
                Objects.equals(potCity, position.potCity) && Objects.equals(potEducation, position.potEducation) &&
                Objects.equals(company, position.company);
    }

    @Override
    public int hashCode() {
        return Objects.hash(potId, potName, potMaxMoney, potMinMoney, potCity, potEducation, company);
    }

    @Override
    public String toString() {
        return "Position:" +
                "potId=" + potId +
                ", potName='" + potName + '\'' +
                ", potMaxMoney=" + potMaxMoney +
                ", potMinMoney=" + potMinMoney +
                ", potCity='" + potCity + '\'' +
                ", potEducation='" + potEducation + '\'' +
                ", company=" + company.getComName()
                ;
    }

    public int getPotId() {
        return potId;
    }

    public void setPotId(int potId) {
        this.potId = potId;
    }

    public String getPotName() {
        return potName;
    }

    public void setPotName(String potName) {
        this.potName = potName;
    }

    public float getPotMaxMoney() {
        return potMaxMoney;
    }

    public void setPotMaxMoney(float potMaxMoney) {
        this.potMaxMoney = potMaxMoney;
    }

    public float getPotMinMoney() {
        return potMinMoney;
    }

    public void setPotMinMoney(float potMinMoney) {
        this.potMinMoney = potMinMoney;
    }

    public String getPotCity() {
        return potCity;
    }

    public void setPotCity(String potCity) {
        this.potCity = potCity;
    }

    public String getPotEducation() {
        return potEducation;
    }

    public void setPotEducation(String potEducation) {
        this.potEducation = potEducation;
    }

    public Company getCompany() {
        return company;
    }

    public void setCompany(Company company) {
        this.company = company;
    }
}

